//	Blogger PopupComment Zapper
//		by Ruben Llibre (ruben.llibre@gmail.com)
//	Creation Date: 8/7/2006
//	Version: 0.1
//----------------------------------------------------------------------------
//	CHANGELOG:
//	0.1: initial version
//-----------------------------------------------------------------------------
// ==UserScript==
// @name          Blogger PopupComments Zapper
// @namespace     http://diveintogreasemonkey.org/download/
// @description   change PopUpComments in blogspot blogs into normal forms
// @include       http://*.blogspot.com/
// ==/UserScript==



//check if they have ispopup=true
function isPopupTrue(link)
{
//http://www.blogger.com/comment.g?blogID=-------&postID=-----&isPopup=true
	return link.href.indexOf('&isPopup=true');
}

//change href to correct;
function fixHref(link,indexOfPopup)
{
	var newHref = link.substring(0,indexOfPopup);
	newHref += '&isPopup=false';
	return newHref;
}

//main body
	var hyperlinks = document.getElementsByTagName('a');
	var searchResult;
	//check all hyperlinks
	for (var i=0 ; i<= hyperlinks.length ; i++)
	{
		searchResult = isPopupTrue(hyperlinks.item(i) );
		//if result is found
		if (-1 !=  searchResult)
		{
			hyperlinks.item(i).target = '_self';
			hyperlinks.item(i).href = fixHref(hyperlinks.item(i).href,searchResult);
			//alert(hyperlinks.item(i).href);
			//document.writeln(fixHref(hyperlinks.item(i),searchResult) );
		}
	}

//add code to the load of the page
//window.addEventListener('load', zapPopupComments(),true);